import Vue from 'vue'
import VueRouter from 'vue-router'
import login from '../pages/login.vue'
import home from '../pages/home/home.vue'
import index from '../pages/index.vue'
import campusUse from '../pages/index/campusUse.vue'
import serve from '../pages/serve.vue'
import regular from '../pages/regular.vue'
import news from '../pages/news.vue'
import consume from '../pages/consume.vue'
import explain from '../pages/explain.vue'
import lookPersonalInfo from '../pages/serve/lookPersonalInfo.vue'
import changePersonalInfo from '../pages/serve/changePersonalInfo.vue'
import changePwd from '../pages/serve/changePwd.vue'
import applyCampus from '../pages/serve/applyCampus.vue'
import lostCampus from '../pages/serve/lostCampus.vue'
import chargeCampus from '../pages/serve/chargeCampus.vue'
import waterAndElectricity from '../pages/serve/waterAndElectricity.vue'
import chargeNet from '../pages/serve/chargeNet.vue'
import myBill from '../pages/serve/myBill.vue'
import suggestion from '../pages/serve/suggestion.vue'
import canteen from '../pages/consume/canteen.vue'
import supermarket from '../pages/consume/supermarket.vue'
import lostAndFound from '../pages/serve/lostAndFound.vue'

Vue.use(VueRouter)

const router = new VueRouter({
  routes: [
    // 自动重定向到login登录页
    { path: '/', redirect: '/login' },
    { path: '/login', component: login },
    {
      path: '/home',
      component: home,
      redirect: '/index', //重定向
      children: [
        { path: '/index', component: index },
        { path: '/serve', component: serve },
        { path: '/regular', component: regular },
        { path: '/news', component: news },
        {
          path: '/consume',
          component: consume,
          redirect: '/canteen',
          children: [
            { path: '/canteen', component: canteen },
            { path: '/supermarket', component: supermarket }
          ]
        },
        { path: '/explain', component: explain },
        // 一卡通使用、问题解答、最新资讯路由
        { path: '/campusUse', component: campusUse },
        // serve 路由
        { path: '/lookPersonalInfo', component: lookPersonalInfo },
        { path: '/changePersonalInfo', component: changePersonalInfo },
        { path: '/changePwd', component: changePwd },
        { path: '/applyCampus', component: applyCampus },
        { path: '/lostCampus', component: lostCampus },
        { path: '/chargeCampus', component: chargeCampus },
        { path: '/waterAndElectricity', component: waterAndElectricity },
        { path: '/chargeNet', component: chargeNet },
        { path: '/myBill', component: myBill },
        { path: '/suggestion', component: suggestion },
        { path: '/lostAndFound', component: lostAndFound }
      ]
    }
  ]
})

export default router
